function checkLogin(data){
	if (data && 'accountId' in data && !data.accountId) {
		return '请登录';
	}
	return ''
}
function postRequst(url, data, str) {
	if (typeof str === 'undefined') {
		return postRequstJson(url, data);
	}else{
		return postRequstStr(url, data);
	}
}
function postRequstJson(url, data) {
	let result = axios({
		method: 'post',
		url: url,
		data: data,
		header: {
			'Content-Type': 'application/json'
		}
	}).then(function(resp){
		return resp.data;
	}).
	catch(function(error){
		return errResp(error);
	});
	return result;
}
function postRequstStr(url, data) {
	let result = axios({
		method: 'post',
		url: url,
		data: data,
		transformRequest: [function(data) {
			let ret = '';
			for (let i in data) {
				ret += encodeURIComponent(i) + '=' + encodeURIComponent(data[i]) + "&";
			}
			return ret;
		}],
		header: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	}).then(function(resp){
		return resp.data;
	}).
	catch(function(error){
		return errResp(error);
	});
	return result;
}
function getRequst(url, paramObj) {
	let pp = null;
	if(paramObj){
		pp = Object.keys(paramObj)
        .map(key => encodeURIComponent(key) + '=' + encodeURIComponent(paramObj[key]))
        .join('&');
	}
	var result = axios({
		method: 'get',
		url: url + (pp==null?'':'?' + pp)
	}).then(function(resp) {
		return resp.data;
	}).
	catch(function(error) {
		return errResp(error);
	});
	return result;
}
function errResp(error){
	let resp = {
		msg: '请求异常',
		status: 500
	}
	if(error.response.status == 401){
		resp.msg = '未认证请求';
		resp.status = 401;
	}
	if(error.response.status == 405){
		resp.msg = '请求不支持';
		resp.status = 405;
	}
	return resp;
}